﻿using System;
using Microsoft.Win32;

namespace CDIO
{
    namespace Util
    {
        public class RegisterOprate
        {
            private const string CDIOKeyName = "CDIO";
            public static void SaveRegData(string strName, object value)
            {
                try
                {
                    RegistryKey regCU = Registry.CurrentUser;
                    RegistryKey software = regCU.OpenSubKey("SOFTWARE", true);
                    RegistryKey cdio = software.CreateSubKey(CDIOKeyName);
                    cdio.SetValue(strName, value);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

            }
            public static object ReadRegData(string strName)
            {
                try
                {
                    RegistryKey regCU = Registry.CurrentUser;
                    RegistryKey software = regCU.OpenSubKey("SOFTWARE", true);
                    RegistryKey cdio = software.CreateSubKey(CDIOKeyName);
                    return cdio.GetValue(strName,0);
                }
                catch (Exception)
                {
                    return null;
                }

            }

        }
        
        
    }
}
